package homework4.exp3;

/**
 * @author fengq
 */
public class Consumer extends Thread {
    private SharedData sharedData;



    public Consumer(SharedData sharedData){
        this.sharedData=sharedData;
    }
    @Override
    public void run(){
        char ch;
        do {
            try{
                Thread.sleep((int)Math.random()*3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            ch=sharedData.getShareChar();
        }while (ch!='D');
    }
}
